package com.ruoyi.project.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.mapper.SysGoodsMapper;
import com.ruoyi.project.system.domain.SysGoods;
import com.ruoyi.project.system.service.ISysGoodsService;

/**
 * 二手物品Service业务层处理
 * 
 * @author jjp
 * @date 2020-04-21
 */
@Service
public class SysGoodsServiceImpl implements ISysGoodsService 
{
    @Autowired
    private SysGoodsMapper sysGoodsMapper;

    /**
     * 查询二手物品
     * 
     * @param goodsId 二手物品ID
     * @return 二手物品
     */
    @Override
    public SysGoods selectSysGoodsById(Long goodsId)
    {
        return sysGoodsMapper.selectSysGoodsById(goodsId);
    }

    /**
     * 查询二手物品列表
     * 
     * @param sysGoods 二手物品
     * @return 二手物品
     */
    @Override
    public List<SysGoods> selectSysGoodsList(SysGoods sysGoods)
    {
        return sysGoodsMapper.selectSysGoodsList(sysGoods);
    }

    @Override
    public int updateItemStatus(SysGoods sysGoods) {
        return sysGoodsMapper.updateItemStatus(sysGoods);
    }

    @Override
    public List<SysGoods> selectSysGoodsLists(SysGoods sysGoods) {
        return sysGoodsMapper.selectSysGoodsLists(sysGoods);
    }

    @Override
    public List<SysGoods> selectUserGoods(SysGoods sysGood) {
        return sysGoodsMapper.selectUserGoods(sysGood);
    }

    /**
     * 新增二手物品
     * 
     * @param sysGoods 二手物品
     * @return 结果
     */
    @Override
    public int insertSysGoods(SysGoods sysGoods)
    {
        sysGoods.setCreateTime(DateUtils.getNowDate());
        return sysGoodsMapper.insertSysGoods(sysGoods);
    }

    /**
     * 修改二手物品
     * 
     * @param sysGoods 二手物品
     * @return 结果
     */
    @Override
    public int updateSysGoods(SysGoods sysGoods)
    {
        sysGoods.setUpdateTime(DateUtils.getNowDate());
        return sysGoodsMapper.updateSysGoods(sysGoods);
    }

    @Override
    public int updateGoodsStatus() {
        return sysGoodsMapper.updateGoodsStatus();
    }

    /**
     * 批量删除二手物品
     * 
     * @param goodsIds 需要删除的二手物品ID
     * @return 结果
     */
    @Override
    public int deleteSysGoodsByIds(Long[] goodsIds)
    {
        return sysGoodsMapper.deleteSysGoodsByIds(goodsIds);
    }

    /**
     * 删除二手物品信息
     * 
     * @param goodsId 二手物品ID
     * @return 结果
     */
    @Override
    public int deleteSysGoodsById(Long goodsId)
    {
        return sysGoodsMapper.deleteSysGoodsById(goodsId);
    }

    @Override
    public int updatePageViews(SysGoods sysGoods) {
        return sysGoodsMapper.updatePageViews(sysGoods);
    }
}
